	/*
	 * To change this template, choose Tools | Templates
	 * and open the template in the editor.
	 */

	package tests.acceptenceTests;

	import exception.LoggedInException;
	import exception.NotRegisteredException;

	import java.rmi.RemoteException;
	import java.sql.SQLException;

	import server.ForumHandler;
	import org.junit.After;
	import org.junit.AfterClass;
	import org.junit.Before;
	import org.junit.BeforeClass;
	import org.junit.Test;

	/**
	 *
	 * @author iziko
	 */
	public class LoginTest {


	    public LoginTest() {
	    }


	    static ForumHandler fh;


	    @BeforeClass
	    public static void setUpClass() throws Exception {
	    	fh = new ForumHandler();
	    	fh.removeUser(12357911,"iziko128");
	    	fh.register("iziko128", "1986", 1, "zi@mail", "izik", "orgad");
	    }

	    @AfterClass
	    public static void tearDownClass() throws Exception {
	        fh.removeUser(12357911,"iziko128");
	    }

	    @Before
	    public void setUp() throws RemoteException, Exception {	
	       
	    }

	    @After
	    public void tearDown() {
	    	fh.logout("iziko128","1986");
	    	
	    }

	    // TODO add test methods here.
	    // The methods must be annotated with annotation @Test. For example:
	    //
	    @Test (timeout=4000)
	     public void testLogin() throws NotRegisteredException, LoggedInException, SQLException{  
	    	fh.login("iziko128","1986");
	    }
	       
	    @Test (expected = LoggedInException.class)
	     public void testDoubleLoginPrevention() throws SQLException, NotRegisteredException, LoggedInException{
	       fh.login("iziko128","1986");
	       fh.login("iziko128","1986");
	    }
}
